<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<c:set var="path" value="${pageContext.request.contextPath}"></c:set>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>流浪动物救助系统</title>
    <link href="${path}/user/static/css/style.css" rel="stylesheet">
    <link href="${path}/user/static/css/bootstrap.min.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <link href="${path}/user/static/css/IE8.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css"href="${path}/user/layui/css/layui.css">
    <![endif]-->
</head>

<body>
<!--头部-->
<jsp:include page="header.jsp"></jsp:include>
<!--幻灯片-->
<section class="ab_img">
    <img src="${path}/user/static/images/news_show1.jpg">
</section>
<!--面包屑-->
<div class="mianb">
    <div class="container">
        <div class="row">
            <div class="zi_bread">
                <div class="bread_con">
                    <h3>宠物百科</h3>
                </div>
            </div>
            <div class="news_show">
                <div class="container">
                    <div class="row">
                        <div class="xiangq">
                            <h4>${kshow.kTitle}</h4>
                            <span>来源：${kshow.uName}&nbsp;&nbsp;&nbsp;&nbsp;发布时间：${kshow.kTime}  </span>
                        </div>
                        <div class="xiangq_top">

                            <p class="col-md-12 col-sm-12 col-xs-12">${kshow.kContent}</p>
                            <div style="text-align: center;">
                                <img ${kshow.kPicture}>
                            </div>

                        </div>

                    <div class="content whisper-content leacots-content details-content">
                     <div class="cont w1000">
                      <div class="whisper-list">
                       <div class="item-box">
                       <div class="review-version">
                        <div class="form-box">
                        <div class="form">
                            <form class="layui-form" action="">
                                <div class="layui-form-item layui-form-text">
                                    <div class="layui-input-block">
											<textarea name="kdContent" placeholder="既然来了，就说几句"
                                                      class="layui-textarea" id="kdCon" cols="128"rows="8" ></textarea>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-input-block" style="text-align: right;">
                                        <input type="button" class="layui-btn definite" value="发布" id="btnIssue">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="volume">
                        全部评论 <span>${count}</span>
                    </div>


                    <div class="list-cont" style="background:#f8f7f7">
                        <c:forEach items="${kd.data}" var="u">
                                <div class="cont">
                                    <div class="text">
                                        <p class="tit">
                                            <span class="name">${u.uName}</span>
                                            <span class="data">${u.kdTime}</span>
                                        </p>
                                        <p class="ct">${u.kdContent}</p>
                                    </div>
                                </div>

                        </c:forEach>

                    </div>
                    </div>
                           </div>
                          </div>
                         </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--回到顶部-->
<a class="top"><span class="glyphicon glyphicon-menu-up jiantou"></span></a>
<script src="${path}/user/static/js/bootstrap.min.js"></script>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<!-- layui的js-->
<script src="${path}/admin/layui/layui.js" charset="utf-8"></script>
<script>
    $(window).scroll(function () {
        $(".top").show();
        if ($(window).scrollTop() <= 300) {
            $(".top").hide();
        }
    });
    $(".top").click(function () {
        $("html").animate({"scrollTop": "0px"}, 100); //IE,FF
        $("body").animate({"scrollTop": "0px"}, 100); //Webkit
    });
</script>

<script type="text/javascript">
    $(function(){
        $("#btnIssue").click(function(){
            layui.use(['laypage','layer' ],function() {
                var laypage = layui.laypage, layer = layui.layer;

                  if(${not empty user && !(user eq null)}){
                    if($("#kdCon").val().trim()!=null&&$("#kdCon").val().trim()!=""){
                        if($("#kdCon").val().trim().length<=200){
                            $.ajax({
                                dataType: "json",
                                type:"post",
                                url:"${path}/knowledgeDis/knowledgeDisAdd",
                                data:{
                                    kdContent: $("#kdCon").val(),
                                    uId: ${not empty user ? user.uid : 0},
                                    kId: "${param.kId}" //获取article传过来的kId
                                },
                                success:function(data) {
                                    console.log(data)
                                    //如果信息是评论成功，就提示信息，重新加载页面
                                    if (data.code == 0) {

                                        layer.msg(data.msg, {
                                            icon : 1,
                                            time : 1000

                                        }, function() {
                                            location.reload();
                                        });
                                    }else {

                                    }

                                }

                            });
                        }  else{
                            layer.msg("评论长度不能超过200！", {
                                icon : 5,
                                time : 1000

                            });
                        }


                    }else{
                        layer.msg("评论不能为空！", {
                            icon : 5,
                            time : 1000

                        });
                    }
                } else{
                      layer.msg("请先登录！", {
                        icon : 5,
                        time : 1000

                    });

                }


            });

        });
    });

</script>







<!--联系我们-->
<jsp:include page="footer.jsp"></jsp:include>
<!--回到顶部-->
<a class="top"><span class="glyphicon glyphicon-menu-up jiantou"></span></a>
<script src="${path}/user/static/js/jquery-3.1.1.min.js"></script>
<script src="${path}/user/static/js/bootstrap.min.js"></script>
<script>
    $(window).scroll(function() {
        $(".top").show();
        if($(window).scrollTop() <= 300) {
            $(".top").hide();
        }
    });
    $(".top").click(function() {
        $("html").animate({
            "scrollTop": "0px"
        }, 100); //IE,FF
        $("body").animate({
            "scrollTop": "0px"
        }, 100); //Webkit
    });
</script>
</body>

</html>
